#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

int DF(char* arr1, char* arr2, int sz)
{
	int count = sz;
	int flag = 1;
	while (count)
	{
		if (strcmp(arr1, arr2) == 0)
		{
			return 1;
		}
		char tmp = arr1[0];
 		for (int i = 0; i < sz - 1; i++)
		{
			arr1[i] = arr1[i + 1];
		}
		arr1[sz - 1] = tmp;
		count--;
	}
	if (flag == 1)
	{
		return 0;
	}
}


int main()
{
	char arr1[] = "AABCD";
	char arr2[] = "DAABC";
	int sz = sizeof(arr1) / sizeof(arr1[0])-1;
	int n = DF(arr1, arr2, sz);
	if(n==1)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}

	return 0;
}